﻿stepcarousel.setup({
    galleryid: 'mygallery',
    beltclass: 'belt',
    panelclass: 'panel',
    autostep: { enable: false, moveby: 1, pause: 3000 },
    panelbehavior: { speed: 200, wraparound: false, persist: true },
    defaultbuttons: { enable: true, moveby: 1, leftnav: ['/app_common/images/left.png', -10, 50], rightnav: ['/app_common/images/right.png', -15, 50] },
    statusvars: ['statusA', 'statusB', 'statusC'],
    contenttype: ['inline']
});

$(function() {
});

function validateForm() {
    var userName = document.getElementById('txtUserName');
    var pwd = document.getElementById('txtPassword');
    var v_c = document.getElementById('txtValidateCode');
    var crm = document.getElementById('chkRememberMe');

    if (userName.value.length == 0) {
        alert("请输入您的用户名?");
        userName.focus();
        return false;
    }
    if (pwd.value.length == 0) {
        alert("请输入您的密码?");
        pwd.focus();
        return false;
    }
    if (v_c.value.length == 0) {
        alert("请输入验证码?");
        v_c.focus();
        return false;
    }

    $.ajax({
        url: 'customer.ashx?Param=login',
        type: 'POST',
        data: 'txtUserName=' + encodeURIComponent(userName.value) + '&txtPassword=' + encodeURIComponent(pwd.value) + '&txtValidateCode=' + encodeURIComponent(v_c.value) + '&chkRememberMe=' + crm.checked,
        dataType: 'json',
        cache: false,
        async: true,
        success: function(jsonResult) {
            switch (jsonResult['DiyStatusCode']) {
                case 1: alert('验证码过期，请重新刷新.'); break;
                case 2: alert('您的浏览器不支持Cookie，请尝试调整您的浏览器设置.'); break;
                case 3: alert('您输入的验证码错误.'); $(v_c).focus().select(); break;
                case 4: break;
                case 5: alert('请输入您的用户名.'); $(userName).focus().select(); break;
                case 6: alert('请输入您的密码.'); $(pwd).focus().select(); break;
                case 7: alert('请输入您的验证码.'); $(v_c).focus().select(); break;
                case 8: alert('对不起，您输入的用户名不存在,请重新输入.'); $(userName).focus().select(); break;
                case 9: alert('对不起，您输入的密码错误,请重新输入.'); $(pwd).focus().select(); break;
                case 10: alert('对不起，您的用户账号已过期.'); $(userName).focus().select(); break;
                case 11: alert('对不起，您的用户账号已禁用.'); $(userName).focus().select(); break;
                case 12: location.href = "index.html"; break;
                case 13: location.href = "" + jsonResult["Url"]; break;
            }
        },
        error: function(xhr, textStatus, errThrown) {
            alert(xhr.responseText);
            alert(textStatus);
            alert(errThrown);
        }
    });
}

function findPassword() {
    location.href = "recoverPasswd.html";
}